<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>页面缓存列表</title>
</head>
<body>
<style>
    .fbutton .add {
        background: url("/framework/flexigrid/css/images/add.png") no-repeat scroll left center rgba(0, 0, 0, 0);
    }
    div.tDiv {
        background: url("/framework/flexigrid/css/images/bg.gif") repeat-x scroll center top #FAFAFA;
        border-color: #CCCCCC #CCCCCC -moz-use-text-color;
        padding:8px;
    }
    #img_add_1,.add,a{
        cursor: pointer;
    }
    .items{
        width:73%;
    }
    .tal{
        text-align: center;
    }
    .helpHide{
        display:none;
    }
    .closeImg{background:url('/quanliadmin/docroot/images/comm/category_icon.png') no-repeat -20px 0px; width:14px;height:14px;margin:8px 6px 0px 10px;cursor:pointer;}
    .openImg{background:url('/quanliadmin/docroot/images/comm/category_icon.png') no-repeat 0px 0px; width:14px;height:14px;margin:8px 6px 0px 10px;cursor:pointer;}
    .childImg{background:url("/quanliadmin/docroot/images/comm/category_icon.png") no-repeat 0px -18px;width:14px;height:14px;margin:0px 6px 0px 10px;}
    .point{background:url('/quanliadmin/docroot/images/comm/point.png') no-repeat 0px 0px; width:8px;height:14px;margin:8px 6px 0px 16px;}
    .childCategory{width:16px;height:16px;background-image:url(/quanliadmin/docroot/images/comm/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -14px;margin-left:34px;cursor:pointer;}
    .editCategory{width:16px;height:16px;background-image:url(/quanliadmin/docroot/images/comm/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -181px;margin-left:34px;cursor:pointer;}
    .delCategory{width:16px;height:16px;background-image:url(/quanliadmin/docroot/images/comm/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -133px;margin-left:34px;cursor:pointer;}
</style>

<div class="ebsig_container">
    <div class="comm_content">
        <div class="search-box">
            <div style="position:relative">
                <form class="form-inline" id="searchForm">
                    <table>
                        <tbody><tr>
                            <td>
                                <span>
                                    分组名称：
                                    <select class="form-control w150" id="group" name="group" onchange="cache.change(this);">
                                        <option value="shop">PC端</option>
                                        <option value="wap">Wap端</option>
                                    </select>
                                </span>
                            </td>
                        </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

        <div class="items2" style="margin:0px auto;width:auto;border-top:0px;">
            <table id="cache_table" class="s" style="width: 100%;margin: 0 auto 8px;">
                <thead>
                    <tr>
                        <th style="padding: 0;">缓存目录</th>
                        <th style="padding: 0;">缓存类型</th>
                        <th style="padding: 0;">缓存路径</th>
                        <th style="padding: 0;">删除缓存</th>
                    </tr>
                </thead>
                <tbody id="cache_body">
                <!--{if isset($list)}-->
                    <!--{foreach from=$list item=item}-->
                    <tr id="cache_<!--{$item.id}-->">
                        <td class="tal">
                            <div><!--{$item.value}--></div>
                        </td>
                        <td class="tal">
                            <div><!--{$item.name}--></div>
                        </td>
                        <td class="tal">
                            <div><!--{$item.path}--></div>
                        </td>
                        <td class="tal">
                            <div class="delCategory" onclick = "cache.cacheDelete(<!--{$item.id}-->,'<!--{$item.group}-->','<!--{$item.value}-->')" style="margin-left: 46px;"></div>
                        </td>
                    </tr>
                    <!--{/foreach}-->
                <!--{/if}-->
                </tbody>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript">
var cache = {

    change: function(obj){
        this.group = obj.value;
        E.loadding.open('正在加载...');
        E.ajax_post({
            url: "/invokingAjax-backend/system/cacheManage.ajax?operFlg=1",
            data: {
                group: this.group
            },
            call: "cache.loadList(o);"
        });

    },
    //加载缓存列表
    loadList:function(o){
        E.loadding.close();
        if(o.code==200){
            $("#cache_body").empty();
            var html = '';
            $.each(o.data,function(k,v){
                html += '<tr id="cache_'+ v.id +'">';
                html += '<td class="tal"><div>'+ v.value +'</div></td>';
                html += '<td class="tal"><div>'+ v.name +'</div></td>';
                html += '<td class="tal"><div>'+ v.path +'</div></td>';
                html += '<td class="tal"><div class="delCategory" onclick="cache.cacheDelete('+ v.id +',\''+ this.group +'\',\''+ v.value +'\')" style="margin-left: 46px;"></div></td>';
                html += '</tr>';
            })
            $("#cache_body").append(html);
        }else{
            E.alert(o.message);
        }
    },
    //删除缓存
    cacheDelete: function(cache_id,group,project){
        this.cache_id = cache_id;
        this.group = group;
        this.project = project;
        E.confirm("您确认要删除选中的缓存吗？", "cache.deleteConfirm");
    },
    deleteConfirm: function(){
        var cache_id = this.cache_id;
        E.loadding.open('正在删除...');
        E.ajax_post({
            url: "/invokingAjax-backend/system/cacheManage.ajax?operFlg=2",
            data: {
                group: this.group,
                project: this.project
            },
            call: function(o) {
                E.loadding.close();
                if (o.code == 200) {
                    E.alert(o.message,2);
                    $('#cache_'+cache_id).remove();
                } else {
                    E.alert(o.message);
                }
            }
        });
    }
}

function autoLoad(){
    E.loadding.open('正在加载...');
    E.ajax_post({
        url: "/invokingAjax-backend/system/cacheManage.ajax?operFlg=1",
        data: {
            group: 'shop'
        },
        call: "cache.loadList(o);"
    });
}

autoLoad();
</script>
</body>
</html>
